<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>array</title>
</head>
<body>
    

    <script>
    
        {

            let ary = [];
            ary['a'] = 1;
            ary['4'] = 2;
            ary.length = 0;
            console.log('ary',ary);

        }

        {
            let ary = [1,2,3,4,5,6];
            ary.length = 0;
            console.log('ary',ary);

        }

        {
            for (var i = 0; i<5;i++) {
                
                (function (i) {
                    setTimeout(() => {
                       console.log(i); 
                    }, 1000*i);
                })(i);
            }


        }

        {
            function g() {
                return 23;
            };

            //let ff = f();
            console.log(typeof g);
        }
    

        {
            // [1,2,3,4,5,9]  12

            function fn (ary,target) {
                
            }


        }


        {
            function fn (target=12,nums=[1,2,3,4,5,9]) {
                let arr = {};
                for (var i = 0; i < nums.length; i++) {
                    if (arr[nums[i]] === 'flag') {
                        console.log('true',arr);
                        return true;
                    }
                    console.log('000',arr);
                    arr[target - nums[i]] = 'flag';
                }
                console.log('false',arr);
                return false;
            }

            console.log(fn());
            
        }

        {

            // - > 

            let set = new Set([1,2,3,4,5,6]);
            set.forEach(ele => {
                console.log('ele',ele);
            });

            for (const ele of set) {
                console.log('ele 0f',ele);
            }

        }

    </script>

</body>
</html>